String.prototype.Trim = function() {   
    return this.replace(/^\s+/g, "").replace(/\s+$/g, "");   
}   
  
function Cookies() {   
    this.get = function(key) {   
        var cookie = document.cookie;   
        var cookieArray = cookie.split(';');   
        var val = "";   
        for (var i = 0; i < cookieArray.length; i++) {   
            if (cookieArray[i].Trim().substr(0, key.length) == key) {   
                val = cookieArray[i].Trim().substr(key.length + 1);   
                break;   
            }   
        }   
        return unescape(val);   
    };   
    this.getChild = function(key, childKey) {   
        var child = this.get(key);   
        var childs = child.split('&');   
        var val = "";   
  
        for (var i = 0; i < childs.length; i++) {   
            if (childs[i].Trim().substr(0, childKey.length) == childKey) {   
                val = childs[i].Trim().substr(childKey.length + 1);   
                break;   
            }   
        }   
        return val;   
    };   
    this.set = function(key, value) {   
        var cookie = "";   
        if (!!key && !!value)   
            cookie += key + "=" + escape(value) + ";";   
        if (!!arguments[2])   
            cookie += "expires=" + arguments[2].toGMTString() + ";";   
        if (!!arguments[3])   
            cookie += "domain=" + arguments[3] + ";";   
        if (!!arguments[4])   
            cookie += "path=" + arguments[4] + ";";   
        document.cookie = cookie;   
    };   
    this.remove = function(key) {   
        var date = new Date();   
        date.setFullYear(date.getFullYear() - 1);   
        var cookie = " " + key + "=;expires=" + date + ";"  
        document.cookie = cookie;   
    }   
}